﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace NDF.Test
{
    [TestClass]
    public class DynamicDataTest
    {
        [TestMethod]
        public void DynamicTest()
        {
            dynamic dynamicObject = new DynamicData();
            dynamicObject["Property1"] = "abc";
            dynamicObject.Property2 = 123;
            dynamicObject["Property3"] = "456";
            //Console.WriteLine(dynamicObject.Property1);
            //Console.WriteLine(dynamicObject["Property1"]);
            //Console.WriteLine(dynamicObject.Property2);
            //Console.WriteLine(dynamicObject["Property3"]);
            Type type = TypeHelper.GetType(dynamicObject);
            //Console.WriteLine(type);
            //var array = type.GetProperties();
            var array = dynamicObject.GetProperties();
            //var array = DynamicObjectHelper.GetProperties(dynamicObject);
            foreach (var item in array)
            {
                //Console.WriteLine(string.Format("fieldName: {0}, fieldValue: {1}", item.Name, item.GetValue(dynamicObject)));
                Console.WriteLine(item);
            }
            //Console.WriteLine(array.Length);
        }
    }
}
